<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>b百度前端学院_斌斌学院_js01</title>
</head>
<body>
    <label>请输入北京今天空气质量:<input id="aqi-input" type="text"/></label>
    <button id="button">确认填写</button>
    <div>您输入的值是：<span id="aqi-display">尚无录入</span></div>
    <script>
        (function () {
            document.getElementById('button').addEventListener("click",function () {
                document.getElementById('aqi-display').innerHTML=document.getElementById('aqi-input').value;
            });
        })()
        /*(function () {
            var input=document.getElementById('aqi-input');
            var button=document.getElementById("button");
            var show=document.getElementById('aqi-display');
            button.onclick=function () {
                if(input.value)
                {
                    show.innerHTML=input.value;
                    //获取html元素的值是innerHTML，获取表单的值是value.
                }
                else
                        show.innerHTML="尚无录入";
            }
        })();*/

    </script>
</body>
</html>